import {applyMiddleware, compose, createStore} from 'redux'
import {logger} from "redux-logger";
import saga from 'redux-saga';
import reducers from "./reducers";
import sags from "./sagas";

const sagaMiddleware = saga();
let middlewares = applyMiddleware(logger,sagaMiddleware);
 // middlewares = applyMiddleware(thunk);
// @ts-ignore
if(window.__REDUX_DEVTOOLS_EXTENSION__){
    // @ts-ignore
    middlewares = compose(middlewares,window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()) ;
}
const store = createStore(reducers,middlewares);
sagaMiddleware.run(sags);
export default store;